//
//  AppDelegate.m
//  微博
//
//  Created by 沈艳男 on 15/10/23.
//  Copyright © 2015年 沈艳男. All rights reserved.
//

#import "AppDelegate.h"
#import "MainViewController.h"
#import "AFNetworkActivityIndicatorManager.h"
#import "UserAccount.h"
#import "NewFeatureController.h"
#import "WelcomeViewController.h"

@interface AppDelegate ()

@end

@implementation AppDelegate


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    self.window  = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
    
    // 统一设置导航控制器的文字颜色
    [[UINavigationBar appearance] setTintColor:[UIColor orangeColor]];
    
//    MainViewController *mvc = [[MainViewController alloc] init];
//    self.window.rootViewController = mvc;
    
//    NewFeatureController *newFeature = [[NewFeatureController alloc] init];
//    self.window.rootViewController = newFeature;
    
    WelcomeViewController *welcome = [[WelcomeViewController alloc] init];
    self.window.rootViewController = welcome;
    
    [self.window makeKeyAndVisible];
    
    UserAccount *userAccount = [UserAccount sharedUserAccount];
    NSLog(@"启动打印用户数据%@", userAccount.userAccount);
    
    [self setNetWork];
    return YES;
}

// 设置网路指示器，一旦设置状态浏览就会出现一个“小菊花”，指示器只负责AFN的网路请求
- (void)setNetWork
{
    AFNetworkActivityIndicatorManager *manager = [AFNetworkActivityIndicatorManager sharedManager];
    manager.enabled = YES;
    
    NSURLCache *cache = [[NSURLCache alloc] initWithMemoryCapacity:4 * 1024 * 10424 diskCapacity:20 * 1024 * 1024 diskPath:nil];
    [NSURLCache setSharedURLCache:cache];
}

@end
